package sv.gob.mh.dgii.dao.rc;

import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import sv.gob.mh.dgii.common.BeanHelper;
import sv.gob.mh.dgii.common.Utils;
import sv.gob.mh.dgii.dao.hibernate.HibernateDaoImpl;
import sv.gob.mh.dgii.model.DeRucPerfil;
import sv.gob.mh.dgii.model.RcDomicilio;


@Repository
@Transactional
public class RcDomicilioDaoImpl extends HibernateDaoImpl implements RcDomicilioDao {

    public static final String _NIT = "nit";
    public static final String _FFINAL = "ffdomicilio";
    public static final String _TIPO_DOMI = "tbDomicilio.cdomicilio";

    public RcDomicilioDaoImpl() {
        super(RcDomicilio.class); 
	} 
    
    public List<RcDomicilio> obtenerDomicilios(String nit){
        String jpql = "SELECT dom FROM RcDomicilio dom left join fetch dom.tbDomicilio left join fetch dom.tbMunicipio where dom.nit=:nit";
        Query q = getSessionFactory().getCurrentSession().createQuery(jpql);
        q.setParameter("nit", nit);
        return q.list();
        
    }
    
}